<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/doc/src/datastreamformat.qdoc -->
<head>
  <title>Qt 4.3: Format of the QDataStream Operators</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">Format of the QDataStream Operators<br /><small></small></h1>
<p>The <a href="qdatastream.html">QDataStream</a> allows you to serialize some of the Qt data types. The table below lists the data types that <a href="qdatastream.html">QDataStream</a> can serialize and how they are represented. The format described below is <a href="qdatastream.html#setVersion">version 8</a>.</p>
<p>It is always best to cast integers to a Qt integer type, such as qint16 or quint32, when reading and writing. This ensures that you always know exactly what size integers you are reading and writing, no matter what the underlying platform and architecture the application happens to be running on.</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td>qint8</td><td><ul>
<li>signed byte</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td>qint16</td><td><ul>
<li>signed 16-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td>qint32</td><td><ul>
<li>signed 32-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td>qint64</td><td><ul>
<li>signed 64-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td>quint8</td><td><ul>
<li>unsigned byte</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td>quint16</td><td><ul>
<li>unsigned 16-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td>quint32</td><td><ul>
<li>unsigned 32-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td>quint64</td><td><ul>
<li>unsigned 64-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><tt>float</tt></td><td><ul>
<li>32-bit floating point number using the standard IEEE 754 format</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><tt>double</tt></td><td><ul>
<li>64-bit floating point number using the standard IEEE 754 format</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><tt>const char *</tt></td><td><ul>
<li>The string length (quint32)</li>
<li>The string bytes, excluding the terminating 0</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qbitarray.html">QBitArray</a></td><td><ul>
<li>The array size (quint32)</li>
<li>The array bits, i.e&#x2e; (size + 7)/8 bytes</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qbrush.html">QBrush</a></td><td><ul>
<li>The brush style (quint8)</li>
<li>The brush color (<a href="qcolor.html">QColor</a>)</li>
<li>If style is CustomPattern, the brush pixmap (<a href="qpixmap.html">QPixmap</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qbytearray.html">QByteArray</a></td><td><ul>
<li>If the byte array is null: 0xFFFFFFFF (quint32)</li>
<li>Otherwise: the array size (quint32) followed by the array bytes, i.e&#x2e; size bytes</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qcolor.html">QColor</a></td><td><ul>
<li>RGB value serialized as a quint32</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qcursor.html">QCursor</a></td><td><ul>
<li>Shape ID (qint16)</li>
<li>If shape is BitmapCursor: The bitmap (<a href="qpixmap.html">QPixmap</a>), mask (<a href="qpixmap.html">QPixmap</a>), and hot spot (<a href="qpoint.html">QPoint</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qdate.html">QDate</a></td><td><ul>
<li>Julian day (quint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qdatetime.html">QDateTime</a></td><td><ul>
<li>Date (<a href="qdate.html">QDate</a>)</li>
<li>Time (<a href="qtime.html">QTime</a>)</li>
<li>0 for <a href="qt.html#TimeSpec-enum">Qt::LocalTime</a>, 1 for <a href="qt.html#TimeSpec-enum">Qt::UTC</a> (quint8)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qfont.html">QFont</a></td><td><ul>
<li>The family (<a href="qstring.html">QString</a>)</li>
<li>The point size (qint16)</li>
<li>The style hint (quint8)</li>
<li>The char set (quint8)</li>
<li>The weight (quint8)</li>
<li>The font bits (quint8)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qhash.html">QHash</a>&lt;Key, T&gt;</td><td><ul>
<li>The number of items (quint32)</li>
<li>For all items, the key (Key) and value (T)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qicon.html">QIcon</a></td><td><ul>
<li>The number of pixmap entries (quint32)</li>
<li>For all pixmap entries:<ul>
<li>The pixmap (<a href="qpixmap.html">QPixmap</a>)</li>
<li>The file name (<a href="qstring.html">QString</a>)</li>
<li>The pixmap size (<a href="qsize.html">QSize</a>)</li>
<li>The <a href="qicon.html#Mode-enum">mode</a> (quint32)</li>
<li>The <a href="qicon.html#State-enum">state</a> (quint32)</li>
</ul>
</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qimage.html">QImage</a></td><td><ul>
<li>If the image is null a &quot;null image&quot; marker is saved; otherwise the image is saved in PNG or BMP format (depending on the stream version). If you want control of the format, stream the image into a <a href="qbuffer.html">QBuffer</a> (using <a href="porting4.html#qimageio">QImageIO</a>) and stream that.</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qkeysequence.html">QKeySequence</a></td><td><ul>
<li>A <a href="qlist.html">QList</a>&lt;int&gt;, where each integer is a key in the key sequence</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qlinkedlist.html">QLinkedList</a>&lt;T&gt;</td><td><ul>
<li>The number of items (quint32)</li>
<li>The items (T)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qlist.html">QList</a>&lt;T&gt;</td><td><ul>
<li>The number of items (quint32)</li>
<li>The items (T)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qmap.html">QMap</a>&lt;Key, T&gt;</td><td><ul>
<li>The number of items (quint32)</li>
<li>For all items, the key (Key) and value (T)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qmatrix.html">QMatrix</a></td><td><ul>
<li>m11 (double)</li>
<li>m12 (double)</li>
<li>m21 (double)</li>
<li>m22 (double)</li>
<li>dx (double)</li>
<li>dy (double)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qpair.html">QPair</a>&lt;T1, T2&gt;</td><td><ul>
<li>first (T1)</li>
<li>second (T2)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qpalette.html">QPalette</a></td><td>The disabled, active, and inactive color groups, each of which consists of the following:<ul>
<li>foreground (<a href="qbrush.html">QBrush</a>)</li>
<li>button (<a href="qbrush.html">QBrush</a>)</li>
<li>light (<a href="qbrush.html">QBrush</a>)</li>
<li>midlight (<a href="qbrush.html">QBrush</a>)</li>
<li>dark (<a href="qbrush.html">QBrush</a>)</li>
<li>mid (<a href="qbrush.html">QBrush</a>)</li>
<li>text (<a href="qbrush.html">QBrush</a>)</li>
<li>brightText (<a href="qbrush.html">QBrush</a>)</li>
<li>buttonText (<a href="qbrush.html">QBrush</a>)</li>
<li>base (<a href="qbrush.html">QBrush</a>)</li>
<li>background (<a href="qbrush.html">QBrush</a>)</li>
<li>shadow (<a href="qbrush.html">QBrush</a>)</li>
<li>highlight (<a href="qbrush.html">QBrush</a>)</li>
<li>highlightedText (<a href="qbrush.html">QBrush</a>)</li>
<li>link (<a href="qbrush.html">QBrush</a>)</li>
<li>linkVisited (<a href="qbrush.html">QBrush</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qpen.html">QPen</a></td><td><ul>
<li>The pen styles (quint8)</li>
<li>The pen width (quint16)</li>
<li>The pen color (<a href="qcolor.html">QColor</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qpicture.html">QPicture</a></td><td><ul>
<li>The size of the picture data (quint32)</li>
<li>The raw bytes of picture data (char)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qpixmap.html">QPixmap</a></td><td><ul>
<li>Save it as a PNG image.</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qpoint.html">QPoint</a></td><td><ul>
<li>The x coordinate (qint32)</li>
<li>The y coordinate (qint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qrect.html">QRect</a></td><td><ul>
<li>left (qint32)</li>
<li>top (qint32)</li>
<li>right (qint32)</li>
<li>bottom (qint32)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qregexp.html">QRegExp</a></td><td><ul>
<li>The regexp pattern (<a href="qstring.html">QString</a>)</li>
<li>Case sensitivity (quint8)</li>
<li>Regular expression syntax (quint8)</li>
<li>Minimal matching (quint8)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qregion.html">QRegion</a></td><td><ul>
<li>The size of the data, i.e&#x2e; 8 + 16 * (number of rectangles) (quint32)</li>
<li>10 (qint32)</li>
<li>The number of rectangles (quint32)</li>
<li>The rectangles in sequential order (<a href="qrect.html">QRect</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qsize.html">QSize</a></td><td><ul>
<li>width (qint32)</li>
<li>height (qint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qstring.html">QString</a></td><td><ul>
<li>If the string is null: 0xFFFFFFFF (quint32)</li>
<li>Otherwise: The string length in bytes (quint32) followed by the data in UTF-16</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qtime.html">QTime</a></td><td><ul>
<li>Milliseconds since midnight (quint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td><a href="qvariant.html">QVariant</a></td><td><ul>
<li>The type of the data (quint32)</li>
<li>The null flag (qint8)</li>
<li>The data of the specified type</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td><a href="qvector.html">QVector</a>&lt;T&gt;</td><td><ul>
<li>The number of items (quint32)</li>
<li>The items (T)</li>
</ul>
</td></tr>
</table></p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
